import {
  PRODUCT_TYPE_OPTIONS,
  UP_DOWN_SHELVES_OPTIONS,
  LATENT_PRODUCT_TYPES_OPTIONS,
  PRODUCT_TYPES_ENUMS
} from '@/constants/commodity';
export const FORM_ITEMS = [
  {
    prop: 'state',
    label: '上下架状态：',
    type: 'select',
    clearable: true,
    options: UP_DOWN_SHELVES_OPTIONS
  },
  {
    prop: 'productKind',
    label: '商品大类',
    type: 'select',
    options: LATENT_PRODUCT_TYPES_OPTIONS,
    defaultVal: PRODUCT_TYPES_ENUMS.NORMAL,
  },
  {
    prop: 'categoryPath',
    label: '分类：',
    type: 'input',
  },
  {
    prop: 'spuNo',
    label: 'SPU编码：',
    type: 'input'
  },
  {
    prop: 'skuNo',
    label: 'SKU编码：',
    type: 'input'
  },
  {
    prop: 'productType',
    label: '商品类型：',
    type: 'select',
    clearable: true,
    options: PRODUCT_TYPE_OPTIONS
  },
  {
    prop: 'brandName',
    label: '商品品牌：',
    type: 'input',
  },
  {
    prop: 'productName',
    label: '商品名称：',
    type: 'input'
  },
  {
    prop: 'relevantSupplyUuid',
    label: '供应商编码：',
    type: 'input'
  },
  {
    prop: 'manageAreaId',
    label: '商品管理区域',
    type: 'select',
    options: []
  },
  {
    prop: 'replaceSkuNo',
    label: '替代商品编码：',
    type: 'input'
  },
  {
    prop: 'specDetail',
    label: '规格：',
    type: 'input'
  },
];

export const TABLE_COLUMNS = [
  {
    title: '分类',
    key: 'categoryPath',
  },
  {
    title: 'SPU编码',
    key: 'spuNo',
    width: 80,
  },
  {
    title: 'SKU编码',
    key: 'skuNo',
    width: 80,
  },
  {
    title: '商品名称',
    key: 'productName',
    width: 100,
  },
  {
    title: '管理区域',
    key: 'manageAreaName'
  },
  {
    title: '商品类型',
    key: 'productTypeStr'
  },
  {
    title: '规格',
    key: 'specDetailStr',
  },
  {
    title: '品牌',
    key: 'brandName',
    width: 80,
  },
  {
    title: '上下架状态',
    width: 90,
    render: (h, { row }) => {
      if (row.state === '1') {
        return <span class="success_color">{ row.stateStr }</span>
      }
      if (row.state === '2') {
        return <span class="error_color">{ row.stateStr }</span>
      }
    }
  },
  {
    title: '计量单位',
    key: 'unitName'
  },
  {
    title: '替代商品编码',
    key: 'replaceSkuNo'
  },
  {
    title: '替代商品名称',
    key: 'replaceProductName'
  },
  {
    title: '替代商品规格',
    key: 'replaceSpec'
  },
  {
    title: '替代商品计量单位',
    key: 'replaceUnitName'
  }
];
